home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
newsgroups
/
misc.20031118-20041115
/
000125_fdc@columbia.edu_Fri Feb 27 15:18:51 2004.msg
< prev
next >
Wrap
Internet Message Format
|
2020-01-01
|
3KB
Path: newsmaster.cc.columbia.edu!not-for-mail
From: Frank da Cruz <fdc@columbia.edu>
Newsgroups: comp.protocols.kermit.misc
Subject: Re: Comparing a file function output with built in variables
Date: 27 Feb 2004 20:16:25 GMT
Organization: Columbia University
Lines: 66
Message-ID: <slrnc3v9cp.dor.fdc@sesame.cc.columbia.edu>
References: <bb076936.0402271132.6b6e3c53@posting.google.com>
Reply-To: fdc@columbia.edu
NNTP-Posting-Host: sesame.cc.columbia.edu
X-Trace: newsmaster.cc.columbia.edu 1077912985 9066 128.59.59.56 (27 Feb 2004 20:16:25 GMT)
X-Complaints-To: postmaster@columbia.edu
NNTP-Posting-Date: 27 Feb 2004 20:16:25 GMT
User-Agent: slrn/0.9.7.4 (SunOS)
Xref: newsmaster.cc.columbia.edu comp.protocols.kermit.misc:14830
In article <bb076936.0402271132.6b6e3c53@posting.google.com>,
Matthew Dobbins wrote:
:
: I am writing a client/server kermit script to send a file from one
: location to another, but I only want to send if the file has changed.
: To overcome this, I decided to compare the md5sum output of the two
: files. If they are different, I will send.
:
: I have the md5sum of the server file (the new file) on the remote
: machine in the built in variable \v(inmatch) (i sent it this using
: input/output commands). I would like to compare the \v(inmatch) to
: \f_getblock(\m(channel),32).
:
: To make that last statement clear, here is what I'm doing on the
: remote machine to get the md5sum of the file to be updated:
:
: run md5sum ad.sxi > sum (get the md4sum of the ad file and put into
: file sum)
: file open channel sum (open file for reading in kermit)
:
That's overkill; you can do it all in one statement:
.\%a := \fword(\fcommand(md5sum ad.sxi),1)
That is, assign to \%a the first word of the output of "md5sum ad.sxi".
"help function command" and "help function word" for details.
: ?COMPARE? \v(inmatch) with \f_getblock(\m(channel),32) (they are both
: the same types - 32 long)
: IF the compare is true, i want to hang up, otherwise send
:
if equal "\%a" "\v(inmatch)" {
hangup
} else {
send ad.sxi
}
In general I think you'd rather transfer the file unnecessarily than
skip transferring it when you should have. Thus you might want to precheck
the results for validity; e.g.:
if not defined \%a ...
if not = \flen(\%a) 32 ...
: Can anyone help me with the compare? I have searched the
: documentation and cannot find anything that will do this. Any
: suggestions?
:
"help if". Note that the basic documentation is the manual, "Using
C-Kermit". The online stuff is all supplemental.
Btw, a better way to get the remote md5sum would be to do it through the
server:
query kermit command(md5sum filename)
if fail ...
and then:
if equal \%a \fword(\v(query),1) ...
Not only is this simpler, but the result is transferred to the
script with an error detecting and correcting protocol, which can make
a difference on noisy connections.
- Frank